// pages/user/user.js
var app = getApp()
Page({
    data: {
        imagePath:'',
        name:"",
        finish_head_img:'编辑头像',
        user_num:""
    },

    onShow:function(){
        this.setData({
            imagePath:app.globalData.user_head_imgPath,
            name:app.globalData.user_head_name,
            user_num:app.globalData.user_phone_num
        })
    },

    onHide:function(){
    },

    finish_change:function(){
        this.setData({
            finish_head_img:"完成修改"
        })
        app.globalData.user_head_imgPath=this.data.imagePath;
    },
 
    change_headimg:function(){
        wx.chooseImage({
            count: 1,
            sizeType:['original'],
            success:res=>{
              this.setData({
                  imagePath:res.tempFilePaths[0]
              })
            }
        })
        this.setData({
            finish_head_img:"确认修改？"
        })
        // app.globalData.user_head_imgPath=this.data.imagePath;
    },
    

    change_headname:function(){
        wx.navigateTo({
          url: '/pages/change_name/change_name',
        })
    },

    goto_change_num:function(){
        wx.navigateTo({
          url: '/pages/change_num/change_num',
        })
    },

    goto_mine:function(){
        wx.switchTab({
          url: '/pages/mine/mine',
        })
    }

})